package org.nepu.srr.设备设施本体风险.功能试验.提升旋转系统;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.DataVO;
import org.nepu.sc.domain.CommonMethods;

@Data
public class B221UpdateSystemParams {
    @ApiModelProperty(value = "移井架(合格/不合格)")
    DataVO mooringRail;

    @ApiModelProperty(value = "钻井绞车电机空转试验(合格/不合格)")
    DataVO drillStringTest;

    @ApiModelProperty(value = "钻井绞车运转试验(合格/不合格)")
    DataVO drillStringOperationTest1;

    @ApiModelProperty(value = "钻井绞车运转试验、辅助刹车试验(合格/不合格)")
    DataVO auxiliaryBrakeTest;

    @ApiModelProperty(value = "钻井绞车运转试验(合格/不合格)")
    DataVO drillStringOperationTest2;

    @ApiModelProperty(value = "钻井绞车运转试验(合格/不合格)")
    DataVO drillStringOperationTest3;

    @ApiModelProperty(value = "天车防碰试验(合格/不合格)")
    DataVO impactTest;

    @ApiModelProperty(value = "游车空载下落试验(合格/不合格)")
    DataVO truckEmptyLoadTest;

    @ApiModelProperty(value = "气动绞车运转试验(合格/不合格)")
    DataVO hydraulicStringOperationTest;

    @ApiModelProperty(value = "转盘空转试验：启动前检查/惯刹调试(合格/不合格)")
    DataVO turnTableTest1;

    @ApiModelProperty(value = "转盘空转试验(合格/不合格)")
    DataVO turnTableTest2;

    @ApiModelProperty(value = "液压猫头试验(合格/不合格)")
    DataVO vibrationTest;

    @ApiModelProperty(value = "钻杆动力钳试验(合格/不合格)")
    DataVO drillGrippingTest;

    public B221UpdateSystemResult rate(){
        double fullScore = 130;
        double rateScore = 0;
        if (mooringRail.getData().equals("合格")){
            rateScore += 10;
        }
        if (drillStringTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (drillStringOperationTest1.getData().equals("合格")){
            rateScore += 10;
        }
        if (auxiliaryBrakeTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (drillStringOperationTest2.getData().equals("合格")){
            rateScore += 10;
        }
        if (drillStringOperationTest3.getData().equals("合格")){
            rateScore += 10;
        }
        if (impactTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (truckEmptyLoadTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (hydraulicStringOperationTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (turnTableTest1.getData().equals("合格")){
            rateScore += 10;
        }
        if (turnTableTest2.getData().equals("合格")){
            rateScore += 10;
        }
        if (vibrationTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (drillGrippingTest.getData().equals("合格")){
            rateScore += 10;
        }
        double rate = rateScore / fullScore;
        B221UpdateSystemResult result = new B221UpdateSystemResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
